home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
BMUG Revelations
/
BMUG Revelations.toast
/
Programming
/
Programming Languages
/
Yerk 3.64
/
Toolbox Classes
/
pictures
< prev
next >
Wrap
Text File
|
1993-05-14
|
2KB
|
59 lines
\ 2.1.87 rfl version
\ 4.28.88 rfl moveto needs work
\ 8.31.88 rfl added theClip to this source
\ 8.14.90 rfl moveto fixed
\ 4.11.92 rfl added putResId: as alias for init:
\ 5.13.93 rfl protected getnew:
rect theClip \ global clip rectangle
-1000 dup 1000 dup put: theClip
: +pair { x1 y1 x2 y2 -- x1+y1 x2+y2 } x1 x2 + y1 y2 + ;
\ Interface object for QD picture support
:CLASS Picture <Super Object
Handle picHndl
Int resID \ resource ID if it is a resource
Rect DestRect \ destination rectangle for drawing
\ ( l t r b -- ) Open a new pict with given frame
:M OPEN: Put: destrect 0 abs: destrect call OpenPicture
Put: picHndl ;M
\ ( -- ) terminate this picture definition
:M CLOSE: call ClosePicture ;M
\ ( resID -- )
:M INIT: put: resID ;M
:M PUTRESID: put: resID ;M
\ load the picture from a resource file
:M GETNEW: 0 int: resID call GetPicture dup 0= classerr" 170 put: picHndl
ptr: picHndl 2+ get: rect put: destRect ;M
\ ( w h -- ) Set size in pixels of dest rect
:M SIZE: getTop: destRect +Pair putBot: destRect ;M
\ ( x y -- ) Move dest rect to given location
:M GOTO: { x y -- } Size: destRect x y putTop: DestRect
Size: self ;M
\ ( -- ) Draw the picture in destRect
:M DRAW: get: picHndl abs: destRect
call DrawPicture ;M
\ ( x y resID -- ) Combines the actions of init:, getNew:, goto: & draw:
:M DISP: putResID: self getNew: self goto: self draw: self ;M
\ goto to location and draw self
:M MOVETO: ( x y -- ) goto: self draw: self ;M
\ ( -- ) dispose of picture heap
:M KILL: get: picHndl call KillPicture ;M
;CLASS